C--------------------------------------------------------- 
C		    平面四节点应力/应变自定义单元单元UEL
C			公众号：易木木响叮当		B站：易木木响叮当
C---------------------------------------------------------      
      SUBROUTINE UEL(RHS,AMATRX,SVARS,ENERGY,NDOFEL,NRHS,NSVARS,
     1     PROPS,NPROPS,COORDS,MCRD,NNODE,U,DU,V,A,JTYPE,TIME,DTIME,
     2     KSTEP,KINC,JELEM,PARAMS,NDLOAD,JDLTYP,ADLMAG,PREDEF,
     3     NPREDF,LFLAGS,MLVARX,DDLMAG,MDLOAD,PNEWDT,JPROPS,NJPROP,
     4     PERIOD)
C     
      INCLUDE 'aba_param.inc'
C
      DIMENSION RHS(MLVARX,*),AMATRX(NDOFEL,NDOFEL),
     1     SVARS(*),ENERGY(7),PROPS(3),COORDS(MCRD,NNODE),
     2     U(NDOFEL),DU(MLVARX,*),V(NDOFEL),A(NDOFEL),TIME(2),
     3     PARAMS(*),JDLTYP(MDLOAD,*),ADLMAG(MDLOAD,*),
     4     DDLMAG(MDLOAD,*),PREDEF(2,NPREDF,NNODE),LFLAGS(4),
     5     JPROPS(*)
C 
      CALL K_MATRIX_ZERO(RHS,NDOFEL,NRHS)
      CALL K_MATRIX_ZERO(AMATRX,NDOFEL,NDOFEL)
C
      ST=PROPS(1)
C
      AMATRX(1,1)= ST
      AMATRX(1,2)=-ST
      AMATRX(2,1)=-ST
      AMATRX(2,2)= ST
C
C       DO I = 1,NDOFEL
C           DO J = 1,NDOFEL
C               RHS(I,1) = RHS(I,1) - AMATRX(I,J)*U(J)
C           ENDDO
C       ENDDO
      CALL K_MATRIX_Sub(AMATRX,U,RHS,NDOFEL,NDOFEL,NRHS)
	  
	  
      RETURN
      END
	  
      subroutine K_MATRIX_ZERO (A,n,m)
C			get zero matrix
      INCLUDE 'ABA_PARAM.INC'
      dimension A(n,m)
      do i=1,n
          do j=1,m
              A(i,j) = 0.d0
          end do
      end do
      return
      end 
C
      subroutine K_MATRIX_Sub(A,B,C,l,n,m)
      INCLUDE 'ABA_PARAM.INC'
      dimension A(l,n), B(n,m), C(l,m)
      call k_Matrix_zero(C,l,m)
      do i=1,l
          do j=1,m
              do k=1,n
                  C(i,j) = C(i,j) - A(i,k) * B (k,j)
              end do
          end do
      end do
      return
      end